/*
  * @author 小白 <chuanwei1234@163.com>  
  * @QQ 86844077  
  * @date 2013-05-11
*/

function show_page(url,htmldiv,pagemore,pageindex,pagesize){
	$(pagemore).html("<a href=\"###\">正在加载...</a>");
	$.ajax({
    url: url+"pageindex="+pageindex+"&pagesize="+pagesize,
    type: 'GET',
    dataType: 'html',
    timeout:15000,
    error: function(){
		$(pagemore).html("<a href=\"javascript:show_page('"+url+"','"+htmldiv+"','"+pagemore+"','"+pageindex+"','"+pagesize+"')\">加载失败点击重新加载>></a>");
		$(pagemore).fadeIn();
    },
    success: function(html){
		var gotofocus="#gotofocus"+pageindex;
		pageindex=parseInt(pageindex)+1;
		if (html!=""){
			var htmlarr=html.split("|@#page#@|");
			var divhtml=$(htmldiv).html();
			if (pageindex==2){
				$(htmldiv).html(htmlarr[1]);
			}else{
				$(htmldiv).html(divhtml+htmlarr[1]);	
			}
			$(htmldiv).fadeIn();
			if(htmlarr[0]!="1"){
				$(pagemore).hide();
			}
			else{
				$(pagemore).html("<a href=\"javascript:show_page('"+url+"','"+htmldiv+"','"+pagemore+"','"+pageindex+"','"+pagesize+"')\">查看更多>></a>");
				$(pagemore).fadeIn();
				$(gotofocus).anchorGoWhere({target:1});
			}
		}
		else{
		$(pagemore).hide();
		}
    }});
}


function show_page2(url,htmldiv,pagemore,pageindex,pagesize){
	$.ajax({
    url: url+"pageindex="+pageindex+"&pagesize="+pagesize,
    type: 'GET',
    dataType: 'html',
    timeout:15000,
    error: function(){
		$(pagemore).fadeIn();
    },
    success: function(html){
		var gotofocus="#gotofocus"+pageindex;
		pageindex=parseInt(pageindex)+1;
		if (html!=""){
			var htmlarr=html.split("|@#page#@|");
			var divhtml=$(htmldiv).html();
//			if (pageindex==2){
//				$(htmldiv).html(htmlarr[1]);
//			}else{
				$(htmldiv).html(divhtml+htmlarr[1]);	
//			}
			$(htmldiv).fadeIn();
			if(htmlarr[0]!="1"){
				show_nohave();
			}
			else{
				set_page_next(pageindex);
				$(pagemore).fadeIn();
				$(gotofocus).anchorGoWhere({target:1});
			}
		}
		else{
		$(pagemore).hide();
		}
    }});
}
